﻿@model IPagedList<MVCApp.Models.District>

<table>
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.First().Number)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.First().Name)
        </th>
        <th>
            @Html.DisplayNameFor(model => Model.First().AssignedTo.UserName)
        </th>
        <th>
            @Strings.DistrictReportTypes_Complete
        </th>
        <th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.Number)
        </td>
        <td>
            @Html.ActionLink(item.Name, "Index", "District", new { id=item.Id }, null)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.AssignedTo.UserName)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Reports_LatestCompleteReport.Date)
        </td>
        <td>
            @Html.ActionLink(Strings.Edit, "Edit", new { id=item.Id })
            @Html.ActionLink(Strings.Delete, "Delete", new { id=item.Id })
        </td>
    </tr>
}

</table>

<div class="pagedList">
     @Html.PagedListPager(Model, page => Url.Action("Index", new { page, ViewBag.SearchTerm }), 
            new PagedListRenderOptions { 
                Display = PagedListDisplayMode.IfNeeded, 
                MaximumPageNumbersToDisplay = 10, 
                DisplayLinkToIndividualPages = true, 
                DisplayEllipsesWhenNotShowingAllPageNumbers = false,
                DisplayLinkToFirstPage = PagedListDisplayMode.Never,
                DisplayLinkToPreviousPage = PagedListDisplayMode.IfNeeded,
                PageCountAndCurrentLocationFormat = Strings.PagetListPageCountAndCurrentLocationFormat,    
                DisplayLinkToLastPage = PagedListDisplayMode.Never, 
                } )
</div>


